package bcc.java8.chap12;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.ChronoField;

/**
 * .
 *
 * @author: bcc
 * 2021/1/29
 */
public class Test01LocalDate {

    public static void main(String[] args) {
        LocalDate date = LocalDate.of(2021,1,29);
        System.out.println(date.getYear());
        Month month = date.getMonth();
        System.out.println(month);
        System.out.println(month.getValue());
        int dayOfMonth = date.getDayOfMonth();
        System.out.println(dayOfMonth);
        DayOfWeek dayOfWeek = date.getDayOfWeek();
        System.out.println(dayOfWeek);
        System.out.println(dayOfWeek.getValue());
        int monthLength = date.lengthOfMonth();
        System.out.println(monthLength);

        boolean leapYear = date.isLeapYear();
        System.out.println(leapYear);
        System.out.println(LocalDate.now());

        System.out.println(date.get(ChronoField.YEAR));
        System.out.println(date.get(ChronoField.MONTH_OF_YEAR));
        System.out.println(date.get(ChronoField.DAY_OF_MONTH));
    }
}
